#pragma once
#include<vector>
#include<string>

void unitSignedArrayTest();
void unitTestPrefixes(); 
void checkingMaxPrefixesCorrectness();
void unitTestsLCS();
int vagnerFisherCheck(const std::vector<long long>&, const std::vector<long long>&);
void checkingEditorDifference();

template<class T>
void checkEditorCorrectness(const std::vector<T>& sequence1, const std::vector<T>& sequence2,
		const std::vector<std::pair<char, T> > & editingWay){
	int LCS_Difference = get_edit_distance(sequence1.begin(), sequence1.end(), sequence2.begin(), sequence2.end());
	int position1 = 0;
	int position2 = 0;
	int difference_count = 0;
	for (int cnt = 0; cnt < editingWay.size(); ++cnt){
		if (editingWay[cnt].first == ' '){
			if (position1 < sequence1.size() && position2 < sequence2.size()){
				if (sequence1[position1] == sequence2[position2] && sequence1[position1] == editingWay[cnt].second){
					position1++;
					position2++;
				}
				else{
					throw std::runtime_error("Wrong recovering\n");
				}
			}
			else{
				throw std::runtime_error("Out of range error\n");
			}
		}
		else if (editingWay[cnt].first == '-'){
			if (position1 < sequence1.size() && sequence1[position1] == editingWay[cnt].second){
				position1++;
				difference_count++;
			}
			else{
				throw std::runtime_error("There isn't -\n");
			}
		}
		else{
			if (position2 < sequence2.size() && sequence2[position2] == editingWay[cnt].second){
				position2++;
				difference_count++;
			}
			else
				throw std::runtime_error("There isn't + \n");
		}
	}
	if (difference_count != LCS_Difference)
		throw std::runtime_error("Difference is wrong\n");
}

void unitCheckEditorPath();
void stressCheckEditorPath();
void streamCheckEditorPath();
